export const enums = {
  encryption: "M2QilGtVp+FKP+LQ/3Arpw==",
  aseKey: "12345678",
  signSaltKey: "bL*Bh&F7hqz5r61M#S5Npx#zBrp$xrllkJ2j5^Bs",
  // signSaltKey: "h*Ut0AWdh7YQCiAnwAc%NAsB8eh^qhAIytN7DQTJ",
  test: "lixinglong"
};

//验签秘钥  "I^FnD4G#tC$ABat@#z8@Am1mfeP@pyzpbjjP@i^r*r6YxMlcER6t@Bjw$kLdAMX5"
//登录密码 秘钥 "cnaHXu3A@*&D2279ZA8H&h0vhmTpfhW@"
//支付密码  秘钥 "jbtbSV0*^D9qZvV016$M&A0sdZVuFr0B"
//递归排序的函数
export const objKeySort = (obj) => {
  var newkey = Object.keys(obj).sort();
  //先用Object内置类的keys方法获取要排序对象的属性名，再利用Array原型上的sort方法对获取的属性名进行排序，newkey是一个数组
  var newObj = {};//创建一个新的对象，用于存放排好序的键值对
  for (var i = 0; i < newkey.length; i++) {//遍历newkey数组
    //如果是数组
    if (Array.isArray(obj[newkey[i]])) {
      let arr = []
      for (let m in obj[newkey[i]]) {
        if (typeof obj[newkey[i]][m] == "object") {
          arr.push(objKeySort(obj[newkey[i]][m]))
        } else {
          arr.push(obj[newkey[i]][m])
        }
      }
      newObj[newkey[i]] = JSON.stringify(arr)
    } else if (typeof obj[newkey[i]] == "object") {
      newObj[newkey[i]] = newkey[i]
      objKeySort(obj[newkey[i]])
    } else {
      newObj[newkey[i]] = obj[newkey[i]] // 向新创建的对象中按照排好的顺序依次增加键值对
    }
  }
  return newObj//返回排好序的新对象
}
export const sortASCII = (obj) => { // 排序
  var arr = new Array();
  var num = 0;
  for (var i in obj) {
    arr[num] = i;
    num++;
  }
  var sortArr = arr.sort();
  var sortObj = {};
  for (var i in sortArr) {
    sortObj[sortArr[i]] = obj[sortArr[i]];
  }
  console.log(sortObj)
  return sortObj
}
export const uuidMiddle = () => {
  var s = [];
  var hexDigits = "0123456789abcdef";
  for (var i = 0; i < 36; i++) {
    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
  }
  s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
  s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
  // uuid 中间无-
  s[8] = s[13] = s[18] = s[23] = "";
  var uuid = s.join("");
  return uuid;
}